package com.agileai.bpm.controller.emulation;

import com.agileai.bpm.webservice.BPMService;
import com.agileai.bpm.webservice.LaunchWorkItem;
import com.agileai.bpm.webservice.SubmitWorkItem;
import com.agileai.hotweb.common.BeanFactory;

public class ProcessHelper {
	private BPMService bpmService = null;
	
	private static ProcessHelper instance = new ProcessHelper();
	
	private ProcessHelper(){
		BeanFactory beanFactory = BeanFactory.instance();
		this.bpmService = (BPMService)beanFactory.getBean("bpmService");
	}
	
	public static ProcessHelper instance(){
		return instance;
	}
	
	public BPMService getBPMService(){
		return this.bpmService;
	}
	
	public LaunchWorkItem createLaunchWorkItem(String processCode){
		LaunchWorkItem bpmLaunchWorkItem = new LaunchWorkItem();
		bpmLaunchWorkItem.setProcessId(processCode);
		return bpmLaunchWorkItem;
	}
	
	public SubmitWorkItem createSubmitWorkItem(String processURI,String procInstanceId,String activityCode){
		SubmitWorkItem processWorkItem = new SubmitWorkItem();
		processWorkItem.setProcessId(processURI);
		processWorkItem.setProcessInstanceId(procInstanceId);
		processWorkItem.setActivityCode(activityCode);
		return processWorkItem;
	}
}